﻿@*Authorize.Net*@

@if(ViewBag.Mode == "Place")
{
    <div class="hint">
        <p>@T(Res.Of(ViewBag.Mode).Name("Hint"))</p>
    </div>
}
else if(ViewBag.Mode == "Process")
{
    var attrs = (Model.Attributes as IEnumerable<dynamic>);
    string req = String.Format("{0}?x_fp_hash={1}&x_fp_sequence={2}&x_fp_timestamp={3}&x_login={4}&x_type={5}" +
        "&x_show_form={6}&x_relay_response={7}&x_delim_data={8}&x_amount={9}&x_invoice_num={10}" +
        "&x_description={11}&x_cust_id={12}&x_address={13}&x_city={14}&x_state={15}&x_zip={16}&x_country={17}" +
        "&x_phone={18}&x_email={19}&x_test_request={20}&x_receipt_link_method=POST&x_receipt_link_text={21}" +
        "&x_receipt_link_url={22}",
        JDM.String(attrs.Single(x => JDM.String(x.Key) == "gateway").Value),
        JDM.String(attrs.Single(x => JDM.String(x.Key) == "x_fp_hash").Value),
        JDM.String(attrs.Single(x => JDM.String(x.Key) == "x_fp_sequence").Value),
        JDM.String(attrs.Single(x => JDM.String(x.Key) == "x_fp_timestamp").Value),
        JDM.String(attrs.Single(x => JDM.String(x.Key) == "x_login").Value),
        JDM.String(attrs.Single(x => JDM.String(x.Key) == "x_type").Value),
        JDM.String(attrs.Single(x => JDM.String(x.Key) == "x_show_form").Value),
        JDM.String(attrs.Single(x => JDM.String(x.Key) == "x_relay_response").Value),
        JDM.String(attrs.Single(x => JDM.String(x.Key) == "x_delim_data").Value),
        JDM.String(attrs.Single(x => JDM.String(x.Key) == "x_amount").Value),
        JDM.String(attrs.Single(x => JDM.String(x.Key) == "x_invoice_num").Value),
        JDM.String(attrs.Single(x => JDM.String(x.Key) == "x_description").Value),
        JDM.String(attrs.Single(x => JDM.String(x.Key) == "x_cust_id").Value),
        JDM.String(attrs.Single(x => JDM.String(x.Key) == "x_address").Value),
        JDM.String(attrs.Single(x => JDM.String(x.Key) == "x_city").Value),
        JDM.String(attrs.Single(x => JDM.String(x.Key) == "x_state").Value),
        JDM.String(attrs.Single(x => JDM.String(x.Key) == "x_zip").Value),
        JDM.String(attrs.Single(x => JDM.String(x.Key) == "x_country").Value),
        JDM.String(attrs.Single(x => JDM.String(x.Key) == "x_phone").Value),
        JDM.String(attrs.Single(x => JDM.String(x.Key) == "x_email").Value),
        JDM.String(attrs.Single(x => JDM.String(x.Key) == "x_test_request").Value), 
        T(Res.In("Common").Of("Act").Name("Done")),
        Url.Action(Loc.Act("IPN").Ctrl("Payment").Set(new
        {
            handlerID = "15498e59-55f6-4039-b42f-a262235c601c"
        }).Localized().Proto("http")));
    if(!Svc.Config(Par.In("WebPortal").Name("DebugMode"), Context.IsDebuggingEnabled))
    {
        <script type="text/javascript">
            jQuery(document).ready(function() {
                setTimeout(function() {
                    window.location = '@req';
                }, 3000);
            });
        </script>
    }
    <div class="box">
        <section>
            <div class="hint">
                @if(Svc.Config(Par.In("WebPortal").Name("DebugMode"), Context.IsDebuggingEnabled))
                {
                    <p>@req</p>
                }
                <p>@T(Res.Of(ViewBag.Mode).Name("Hint"))</p>
            </div>
        </section>
    </div>
}